import SETTING from '@/settings'
import request from '@/utils/request'

const prefixUrl = ''

const {
  WEBAPI,
  PREAPI,
  PROXY
} = SETTING

// 上传
export function getTestTextUrl() {
    return (PROXY ? PREAPI : WEBAPI + PREAPI) + '/file/upload'
}

// 上传
export function getUploadAndSendUrl() {
    return (PROXY ? PREAPI : WEBAPI + PREAPI) + '/file/uploadAndSend'
}

// 发送mqtt文本消息
export function sendTextMessage(deviceId,topic,msg) {
  return request({
    url: prefixUrl + '/sendMqttMsg',
    method: 'put',
    params: {
      deviceId,
      topic,
      msg
    }
  })
}

// 发送mqtt文本消息
export function getMessageList(deviceId,topic,msg) {
  return request({
    url: prefixUrl + '/msg/list',
    method: 'get',
    params: {}
  })
}
